package com.forezp.thinking.chapter14;



import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.List;

/**
 * Created by forezp on 2017/12/4.
 */
public class  Circle extends Shape {
    @Override
     void draw() {
        System.out.println("Circle draw");
    }

    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        List<Shape> list = Arrays.asList(new Circle(),new Circle());
        for (Shape shape : list) {
            shape.draw();
            Class clz = shape.getClass();
            System.out.println(clz.hashCode());
            Circle circle= (Circle) clz.cast(shape);
            Method method=clz.getDeclaredMethod("draw",null);
            method.invoke(shape,null);
            Class clz2=Circle.class;
            Class clz3=Integer.class;
            Class clz4=Integer.TYPE;
        }
    }
}
